package com.example.mapper;

import com.example.bean.Admin;
import com.example.bean.SuperAdmin;
import com.example.bean.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

public interface LoginMapper {

    //用户查询
    @Select("SELECT * FROM user where userPhone=#{userPhone} OR userIdentity=#{userIdentity} OR card=#{card}")
    public User judgeLogin(@Param("userPhone") String userPhone, @Param("userIdentity") String userIdentity,@Param("card") String card);
    //用户手机号登录
    @Select("SELECT * FROM user WHERE userPhone=#{userPhone} AND userPassword=#{userPassword}")
    public User userPhoneLogin(@Param("userPhone") String userPhone, @Param("userPassword") String userPassword);
    //用户身份证号登录
    @Select("SELECT * FROM user WHERE userIdentity=#{userIdentity} AND userPassword=#{userPassword}")
    public User userIdentityLogin(@Param("userIdentity") String userIdentity, @Param("userPassword") String userPassword);
    //用户借书卡号登录
    @Select("SELECT * FROM user WHERE card=#{card} AND userPassword=#{userPassword}")
    public User cardLogin(@Param("card") String card, @Param("userPassword") String userPassword);
    //管理员登录
    @Select("SELECT * FROM admin WHERE adminId=#{adminId} AND adminPassword=#{adminPassword}")
    public Admin adminLogin(@Param("adminId") String adminId, @Param("adminPassword") String adminPassword);
    //超级管理员登录
    @Select("SELECT * FROM superAdmin WHERE superAdmId=#{superAdmId} AND superAdmPassword=#{superAdmPassword}")
    public SuperAdmin SuperAdmLogin(@Param("superAdmId") String superAdmId, @Param("superAdmPassword") String superAdmPassword);
}
